# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=ttyd
pkgver=1.7.3
pkgrel=1
pkgdesc='Share your terminal over the web'
arch=('loong64' 'x86_64')
url='https://tsl0922.github.io/ttyd/'
license=('MIT')
depends=(
  'zlib'
  'libwebsockets'
  'json-c'
  'libuv'
  'openssl'
)
makedepends=('git' 'cmake')
_commit='a8cae7558af64fe9f5179707870119fa8cb57e2e'
source=("$pkgname::git+https://github.com/tsl0922/ttyd#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

build() {
  cmake \
    -S "$pkgname" \
    -B build \
    -D CMAKE_BUILD_TYPE='None' \
    -D CMAKE_INSTALL_PREFIX='/usr' \
    -W no-dev

  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" "$pkgname/LICENSE"
}
